import request from '@/utils/request'

const api = {
  getCgrkHUrl: '/caigou/get_cgrk_h',
  getCgrkBByPkUrl: '/caigou/get_chrkb_bypk',
  getDaohuoBullUrl: '/caigou/get_daohuobill_page',
  getDaohuoBullSUrl: '/caigou/get_daohuobills',
  addCgdhBarcodeUrl: '/caigou/add_cgdh_barcode',
}

export async function addCgdhBarcodeApi(params: Map<string, any>) {
  const res = await request({
    url: api.addCgdhBarcodeUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function getDaohuoBullSApi(params: Map<string, any>) {
  const res = await request({
    url: api.getDaohuoBullSUrl,
    method: 'get',
    params,
    timeout: 50000,
  })
  return res
}

export async function getDaohuoBullApi(data: Map<string, any>) {
  const res = await request({
    url: api.getDaohuoBullUrl,
    method: 'post',
    data,
    timeout: 50000,
  })
  return res
}

export async function getCgrkBByPkApi(params: Map<string, any>) {
  const res = await request({
    url: api.getCgrkBByPkUrl,
    method: 'get',
    params,
    timeout: 50000,
  })
  return res
}

export async function getCgrkHApi(data: Map<string, any>) {
  const res = await request({
    url: api.getCgrkHUrl,
    method: 'post',
    data,
    timeout: 50000,
  })
  return res
}
